package com.quanyan.place.biz;

import com.quanyan.api.APIResponse;
import com.quanyan.place.entity.TbBizPlace;
import com.quanyan.place.entity.TbBizPlaceUnitSalePlan;
import com.quanyan.place.entity.apireq.ReqSearchVo;
import com.quanyan.place.entity.apiresp.RespBizPlaceBaseInfo;
import com.quanyan.place.entity.apiresp.RespDict;
import com.quanyan.search.entity.request.ReqPlaceSearchInfo;
import com.quanyan.search.entity.request.ReqPlaceSearchInfoNew;
import com.quanyan.search.entity.response.PlaceSearchResponse;
import com.quanyan.search.entity.response.SearchResponses;
import com.quanyan.search.entity.vo.PlaceIndexInfo;

import java.util.List;
import java.util.Map;

/**
 * Created by jingliu on 16/6/1.
 */
public interface ISearchService {

    /**
     * 获取搜索排序种类
     * @return
     */
    List<RespDict> getSearchSort();

    /**
     * 根据搜索引擎得到的对象列表转换成客户端用的对象列表
     * @param placeSearchResponses
     * @param reqSearchVo（获取请求参数按搜索类别排序：运动类别）
     * @return
     */
    List<RespBizPlaceBaseInfo> getSearchBizPlaceBaseInfos(List<PlaceSearchResponse> placeSearchResponses,
                                                          ReqSearchVo reqSearchVo, Integer startPosition);

    /**
     * 签约场馆添加销售计划索引
     * @param tbBizPlace
     * @param ids
     */
    void addPlaceIndex(TbBizPlace tbBizPlace, List<String> ids);

    /**
     * 销售数据对象转为销售搜索对象
     * @param tbBizPlaceUnitSalePlan
     * @return
     */
//    PlaceSalePlanInfo getPlaceSalePlanInfo(TbBizPlaceUnitSalePlan tbBizPlaceUnitSalePlan);

    /**
     * 搜索请求对象转为搜索对象
     * @param reqSearchVo
     * @return
     */
    ReqPlaceSearchInfo getReqPlaceSearchInfo(ReqSearchVo reqSearchVo);


    /**
     * 根据条件搜索
     * @param reqPlaceSearchInfo
     * @return
     */
    APIResponse<SearchResponses<List<PlaceSearchResponse>>> listSearch(ReqPlaceSearchInfo reqPlaceSearchInfo);
    APIResponse<SearchResponses<List<PlaceSearchResponse>>> searchPlaceInfoListNew(ReqPlaceSearchInfoNew reqPlaceSearchInfo);

    /**
     * 删除所有Doc
     * @return
     */
    boolean delAllDoc(Integer type);

    /**
     * 导入几天的场馆索引
     * @param days
     * @return
     */
    boolean importPlaceIndexDays(Integer days);

    /**
     * 删除过期索引
     * @return
     */
    public boolean delIndexBefore14Day();

    APIResponse deleteDocById(Integer placeId, Integer type);

    APIResponse insertDocs(List<PlaceIndexInfo> insertPlaceIndexInfos);

    void addPlaceSaleIndex(Integer placeId);

    APIResponse importIndex(Map map);

    boolean updatePlaceIndex();
}
